<extend name="Layout:ly2"/>

<block name="head">
    <script type="text/javascript">
        $(function(){

            $("#btn-submit").click(function(){
                var id = $("input[name='id']").val();
                var uid = $("input[name='uid']").val();
                var content = $("textarea").val();
                var catid = $("input[name='catid']").val();
                if (uid == '') {layer.msg('用户id不能为空');return false;}
                if (content =='') {layer.msg('内容不能为空');return false;}
                if (catid == '') {layer.msg('问题分类不能为空');return false;}

                $.get("{:U('Admin/Ask/question_add')}",{'action':'add','uid':uid,'content':content,'catid':catid},function(msg){
                    if(msg == 1){
                        layer.msg("添加成功，1秒后自动关闭~~",{ico:1,time:1000},function(){
                            parent.window.location.reload();    //刷新父页面
                        })
                    }else{
                        layer.msg("添加失败，1秒后自动关闭~~",{ico:1,time:1000},function(){
                            parent.window.location.reload();    //刷新父页面
                        })
                    }
                })
            })
        })
    </script>

</block>

<block name="body">
    <div class="container-fluid">
        <h3 id="title" align="center">修改问题</h3>
        <div class="padding20">
            <div class="form-horizontal p90">
                <div class="form-group">
                    <label class="col-sm-2 control-label">问题id：</label>
                    <div class="col-sm-8">
                        <input type="text" name="id" class="form-control" id="id" required value="{$edit_list['0']['id']}" readonly />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">用户名：</label>
                    <div class="col-sm-8">
                        <input type="text" name="nickname" class="form-control" id="nickname" value="{$edit_list[0]['nickname']}" readonly/>
                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">用户id：</label>
                    <div class="col-sm-8">
                        <input type="text" name="uid" class="form-control" id="uid" value="{$edit_list[0]['uid']}" />
                    </div>
                    <label class="col-sm-2 control-label">请修改用户id</label>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">问题内容：</label>
                    <div class="col-sm-8">
                        <textarea type="text" name="content" class="form-control" id="content" >{$edit_list[0]['content']}</textarea>
                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">问题分类：</label>
                    <div class="col-sm-8">
                        <input type="text" name="catname" class="form-control" id="catname" value="{$edit_list[0]['cat_name']}" readonly/>
                    </div>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">问题分类id</label>
                    <div class="col-sm-8">
                        <input type="text" name="catid" class="form-control" id="catid" value="{$edit_list[0]['catid']}" />
                    </div>
                    <label class="col-sm-2 control-label">请修改分类id</label>
                    <div class="col-sm-2"></div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" id="btn-submit" class="btn btn-success">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
                        <button type="reset" class="btn btn-default">重置</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

</block>